#ifndef PARSER_HEADER_VIZMF_PROJECT
#define PARSER_HEADER_VIZMF_PROJECT

#include <string>
#include "src/core/workspace/field.h"
#include "src/core/workspace/molecule/molecule.h"
#include "src/core/logger/logger.h"
#include "src/core/scene/moleculedrawer.h"

class Controller;

class Parser
{
public:
//  typedef std::string string;
  enum FileType {Unknown, MOL2, ESP};
  enum FileContent {MoleculeContent = 0x1, LatticeContent = 0x2, FieldContent = 0x4};
  Parser() : sucess(true) {}
  void setFile(const std::string& file, const std::string& cont) { filename = file; contents = cont; }
  void setLogger(Controller* loggerObj) { logger = loggerObj; }
  void parseFile();
  bool sucessfull() const { return sucess; }
  const Molecule& molecule() { return mol; }
  const Lattice& lattice() { return latt; }
  const Field& field() { return fiel; }
  // other get methods to be added
  bool testContent(FileContent c) { return bool(content & c); }
  static void parseAtomProperties(std::istream& stream, VisitorParameters* properties);
  static void parseAtomProperties(const std::string& filemane, VisitorParameters* properties, Controller* logger);
private:
  std::string filename;
  std::string contents;
  Controller* logger;
  bool sucess;

  Molecule mol;
  Lattice latt;
  Field fiel;

  unsigned int content;

  void parseMol2();
  void parseESP();
  FileType detectFileType() const;
};

#endif // PARSER_HEADER_VIZMF_PROJECT
